
const t = getApp();
Page({
    data: {
        agreementArr: ['', '《代理商招募商家协议》', '《代理商招募代理协议》'],
        items: [
            { name: 1, value: '代理商招募商家' },
            { name: 2, value: '代理商招募代理' }
        ],
        agentInt: 1,
        protocol: false,
        second: 0,  
    },

    onLoad(options) {
        this.setData({
            second: Number(options.second)
        })
    },
    protocolBtn() {
        /**
         * 勾选协议
         */
        this.setData({
            protocol: !this.data.protocol,
        })
    },
    bindPickerChange(e) {
        /**
         * 选择招募方式
         */
        this.setData({
            agentInt: Number(e.detail.value),
            protocol: false,
        })
    },
    onPdf() {
        wx.showLoading({
            mask: true,
            title: this.data.agreement
        })
        wx.downloadFile({
            url: this.data.xfjPdf[this.data.agentInt],
            success: function (res) {
                console.log(res)
                const filePath = res.tempFilePath;
                setTimeout(() => {
                    wx.openDocument({
                        filePath: filePath,
                        fileType: 'pdf',
                        success: function (res) {
                            console.log(res)
                        }
                    })
                },100);
                wx.hideLoading();
            }
        })
    },
    // 点击单选,跳出不同界面
    onOk() {
        for(let i=0;i<this.data.items.length;i++)
        if(this.data.agentInt==1)
        {
            wx.navigateTo({
              url: '../user/scancoderegistration/scancodeand-enter',
            })
        }
        else  if(this.data.agentInt==2){
            wx.navigateTo({
                url: '../user/scancoderegistration/scancoderegistration',
              })
        }
           
    }
  


})